.386
.model flat, stdcall
option casemap :none
 
include \masm32\include\msvcrt.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32rt.inc

includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\msvcrt.lib

.data
    Phrase  BYTE "Hello ! PIKACHUUUUUU",0
    Taille=( $ - Phrase )
    File    BYTE "tot.txt",0
.data?
    hFile        HANDLE ?
    srcFile        HANDLE ?
    filledMemory DWORD ?

.code
start: 
    invoke OpenFile, addr File, OF_READ, 0
    mov srcFile, eax 
    invoke CreateFile, addr File, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
    mov hFile,eax
    invoke WriteFile, hFile, ADDR Phrase, Taille, ADDR filledMemory, NULL
    invoke CloseHandle,hFile
    invoke ExitProcess,0

end start